package top.dreamcenter.rss.rsssolverweb.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class RetResult<T> {

    private Integer code;

    private String msg;

    private T data;


    public static <T> RetResult<T> success(T data) {
        return new RetResult<>(200, null, data);
    }

    public static <T> RetResult<T> fail(String msg) {
        return new RetResult<>(-1, msg, null);
    }

    public static <T> RetResult<T> denied() {
        return new RetResult<>(401, "无权访问", null);
    }
}
